import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/inspec/inspect_count_entity.dart';

InspectCountEntity $InspectCountEntityFromJson(Map<String, dynamic> json) {
  final InspectCountEntity inspectCountEntity = InspectCountEntity();
  final String? departmentId = jsonConvert.convert<String>(json['departmentId']);
  if (departmentId != null) {
    inspectCountEntity.departmentId = departmentId;
  }
  final String? departmentName = jsonConvert.convert<String>(json['departmentName']);
  if (departmentName != null) {
    inspectCountEntity.departmentName = departmentName;
  }
  final int? missingNum = jsonConvert.convert<int>(json['missingNum']);
  if (missingNum != null) {
    inspectCountEntity.missingNum = missingNum;
  }
  final int? planNum = jsonConvert.convert<int>(json['planNum']);
  if (planNum != null) {
    inspectCountEntity.planNum = planNum;
  }
  final int? quantityCompleted = jsonConvert.convert<int>(json['quantityCompleted']);
  if (quantityCompleted != null) {
    inspectCountEntity.quantityCompleted = quantityCompleted;
  }
  final int? reExaminationNum = jsonConvert.convert<int>(json['reExaminationNum']);
  if (reExaminationNum != null) {
    inspectCountEntity.reExaminationNum = reExaminationNum;
  }
  final int? taskTotalNum = jsonConvert.convert<int>(json['taskTotalNum']);
  if (taskTotalNum != null) {
    inspectCountEntity.taskTotalNum = taskTotalNum;
  }
  final int? toBeCompleted = jsonConvert.convert<int>(json['toBeCompleted']);
  if (toBeCompleted != null) {
    inspectCountEntity.toBeCompleted = toBeCompleted;
  }
  return inspectCountEntity;
}

Map<String, dynamic> $InspectCountEntityToJson(InspectCountEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['departmentId'] = entity.departmentId;
  data['departmentName'] = entity.departmentName;
  data['missingNum'] = entity.missingNum;
  data['planNum'] = entity.planNum;
  data['quantityCompleted'] = entity.quantityCompleted;
  data['reExaminationNum'] = entity.reExaminationNum;
  data['taskTotalNum'] = entity.taskTotalNum;
  data['toBeCompleted'] = entity.toBeCompleted;
  return data;
}

extension InspectCountEntityExtension on InspectCountEntity {
  InspectCountEntity copyWith({
    String? departmentId,
    String? departmentName,
    int? missingNum,
    int? planNum,
    int? quantityCompleted,
    int? reExaminationNum,
    int? taskTotalNum,
    int? toBeCompleted,
  }) {
    return InspectCountEntity()
      ..departmentId = departmentId ?? this.departmentId
      ..departmentName = departmentName ?? this.departmentName
      ..missingNum = missingNum ?? this.missingNum
      ..planNum = planNum ?? this.planNum
      ..quantityCompleted = quantityCompleted ?? this.quantityCompleted
      ..reExaminationNum = reExaminationNum ?? this.reExaminationNum
      ..taskTotalNum = taskTotalNum ?? this.taskTotalNum
      ..toBeCompleted = toBeCompleted ?? this.toBeCompleted;
  }
}
